﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;

namespace SubwayHelper
{
    /// <summary>
    /// 表示一条地铁线路
    /// </summary>
    public class SubwayLine
    {
        public SubwayLine()
        {
            TransferLines = new List<string>();
        }

        /// <summary>
        /// 线路编号
        /// </summary>
        public string No { set; get; }

        /// <summary>
        /// 是否圆形线路，圆形线路是指头尾相接的线路
        /// </summary>
        public bool IsRound { get; set; }

        /// <summary>
        /// 线路的站点集合
        /// </summary>
        public List<Station> Stations { set; get; }

        /// <summary>
        /// 可换乘的路线集合
        /// </summary>
        public List<string> TransferLines { get; set; }

        /// <summary>
        /// 线路标准名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 返回标准的线路名称
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return Name;
        }
    }

    /// <summary>
    /// 表示一个地铁站点
    /// </summary>
    public class Station
    {
        /// <summary>
        /// 所在线路编号
        /// </summary>
        public string LineNo { set; get; }

        /// <summary>
        /// 站点名称
        /// </summary>
        public string Name { set; get; }

        /// <summary>
        /// 站点在线路上的索引
        /// </summary>
        public int Index { get; set; }

        /// <summary>
        /// 是否可换乘
        /// </summary>
        public bool CanTransfer { set; get; }

        /// <summary>
        /// 换乘站点编号，如多个会用英文逗号隔开
        /// </summary>
        public string TransferNo { set; get; }

    }

    /// <summary>
    /// 查询结果实体
    /// </summary>
    [DataContract]
    public class QueryResult
    {
        /// <summary>
        /// 乘车描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 乘车方案
        /// </summary>
        [DataMember(Name = "乘车方案",Order = 1)]
        public string Suggestion { get; set; }

        /// <summary>
        /// 乘车路线
        /// </summary>
        [DataMember(Name = "乘车路线",Order = 2)]
        public string Route { get; set; }

        /// <summary>
        /// 换乘次数
        /// </summary>
        [DataMember(Name = "换乘次数", Order = 3)]
        public int TransferTimes { get; set; }

        /// <summary>
        /// 站点距离
        /// </summary>
        [DataMember(Name = "站点总数", Order = 4)]
        public int Range { get; set; }

        /// <summary>
        /// 换乘站点
        /// </summary>
        public List<string> TransferStations { set; get; }

    }
}
